﻿using DataLayer.Implementations;
using OurWedding.Models;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
using System.Web;

namespace OurWedding.Helpers
{
    public class InvitationHelper
    {
        public Invitation GetInvitation(string key)
        {
            InvitationApplication app = new InvitationApplication();

            DataLayer.Entities.Invitation dbInv = app.GetByKey(key);

            if (dbInv == null && dbInv.Person != null)
            {
                throw new ArgumentException("Key is not valid");
            }

            Person person = new Person()
            {
                Name = dbInv.Person.Name
            };

            Invitation localInv = new Invitation()
            {
                Person = person,
                TotalInvitees = dbInv.TotalInvitees
            };

            return localInv;
        }
    }
}